package com.seal.yoyoshop.service.impl;

import com.seal.yoyoshop.bin.Admin;
import com.seal.yoyoshop.dao.AdminDao;
import com.seal.yoyoshop.dao.impl.AdminDaoImpl;
import com.seal.yoyoshop.service.AdminService;
import com.seal.yoyoshop.util.SafeUtil;

public class AdminServiceImpl implements AdminService {

    private AdminDao adminDao = new AdminDaoImpl();

    @Override
    public Admin getAdminByUsernameAndPassword(String username, String password) {
        Admin admin = adminDao.SelectAdminByUsernameAndPassword(username, SafeUtil.encode(password));
        return admin;
    }

    @Override
    public Admin getAdminById(Integer id) {
        Admin admin = adminDao.selectAdminById(id);
        return admin;
    }

    @Override
    public boolean updatePassword(Admin admin) {
        boolean flag = adminDao.updatePassword(admin);
        return flag;
    }
}
